<template>
  <div></div>
</template>
<script>
export default {
  created () {
    let arr = [
      {
        id: 1,
        name: '深圳',
        pid: ''
      },
      {
        id: 2,
        name: '广州',
        pid: ''
      },
      {
        id: 3,
        name: '宝安区',
        pid: 1
      },
      {
        id: 4,
        name: '石岩',
        pid: 3
      }
    ]

    let result = [
      {
        id: 1,
        name: '深圳',
        pid: '',
        children: [
          {
            id: 3,
            name: '宝安区',
            pid: 1,
            children: [
              {
                id: 4,
                name: '石岩',
                pid: 3
              }
            ]
          }
        ]
      },
      {
        id: 2,
        name: '广州',
        pid: ''
      }
    ]
  }
}
</script>
<style></style>
